using MediatR;
using TerritoryGame.Domain.ValueObjects;

namespace TerritoryGame.Application.Commands;

public record JoinRoomCommand : IRequest<JoinRoomResult>
{
    public string RoomId { get; init; } = string.Empty; // 改为字符串，支持Guid和房间代码
    public Guid PlayerId { get; init; }
    public string? Password { get; init; }
    public string PlayerNickName { get; init; } = string.Empty;
    public string? RoomCode { get; init; } // 支持通过房间代码加入
}

public record JoinRoomResult
{
    public Guid RoomId { get; init; }
    public Guid PlayerId { get; init; }
    public PlayerColor PlayerColor { get; init; }
    public string RoomName { get; init; } = string.Empty;
    public bool Success { get; init; }
    public string? ErrorMessage { get; init; }
    public string? ErrorCode { get; init; }
}
